import Vue from 'vue'

var variable = {
  defaultToken: 'Basic eWhieS1jbGllbnQ6eWhieS1jbGllbnQ=',
  baseURL: 'http://tgyp.youboy.com',
  jumpSeller: '',
  jumpMall: '',
  baseOrigin: '',
}

if(process.browser){
  variable.baseOrigin = window.location.origin;

  var hostname = window.location.hostname;
  // 本地环境
  if(hostname == 'localhost'){
    variable.baseURL = 'http://tgyp.youboy.com' //本地接口
    variable.jumpSeller = 'http://localhost:6002'
    variable.jumpMall = 'http://localhost:6008'
    variable.baseOrigin = 'http://tgyp.youboy.com'
  // 开发环境
  }else if(hostname == 'dgyp.youboy.com'){

  // 测试环境
  }else if(hostname == 'tgyp.youboy.com') {

  // 生产环境
  }else if(hostname == 'gyp.youboy.com') {

  }
}


export default {
  URL: {
    baseURL: variable.baseURL,
    jumpSeller: variable.jumpSeller,
    jumpMall: variable.jumpMall,
    baseOrigin: variable.baseOrigin,
    oldSiteLogin: 'https://signin.youboy.com/signin.jsp',
    oldSiteIndex: 'http://www.youboy.com/search',
  },
  VAR: {
    defaultToken: variable.defaultToken
  },
}


var variables = {
  install(Vue, options) {
    Vue.prototype.URL = {
      PIC: 'https://yhby-oss.oss-cn-shenzhen.aliyuncs.com',
      File: 'https://yhby-oss.oss-cn-shenzhen.aliyuncs.com',
      baseURL: variable.baseURL,
      jumpSeller: variable.jumpSeller,
      jumpMall: variable.jumpMall,
      baseOrigin: variable.baseOrigin,
      YHTitle: '一呼百应工业品直卖网_【官网】',
      oldSiteLogin: 'https://signin.youboy.com/signin.jsp',
      oldSiteIndex: 'http://www.youboy.com/search',
      mall: '/mallplus',
      downWordFileUrl: 'http://view.officeapps.live.com/op/view.aspx?src=',
    },
    Vue.prototype.Params = {
      operatorId: '1',
    }
  }
}

Vue.use(variables);
